package com.timi_licai.timi_licai_account.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.timi_licai.timi_licai_account.R;
import com.timi_licai.timi_licai_account.listener.CameraDialogInterface;

/**
 * 点击添加信息页面的相机图标 弹出的dialog
 */
public class CameraDialog extends Dialog implements View.OnClickListener {
    private CameraDialogInterface cameraDialogInterface;

    public CameraDialog(Context context, int theme, CameraDialogInterface cameraDialogInterface) {
        super(context, theme);
        this.cameraDialogInterface = cameraDialogInterface;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_camera);
        Button takePhoto = (Button) findViewById(R.id.dialog_camera_take_photo);
        Button fromBook = (Button) findViewById(R.id.dialog_camera_from_book);
        Button cancel = (Button) findViewById(R.id.dialog_camera_cancel);
        takePhoto.setOnClickListener(this);
        fromBook.setOnClickListener(this);
        cancel.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (cameraDialogInterface != null) {
            cameraDialogInterface.getCameraDialogClick(id);
        }

    }
}
